package com.asa.photopicker;

import java.util.ArrayList;

import com.asa.photopicker.photo.MessageSelectMediaFragment;
import com.asa.photopicker.photo.PhotoActivity;
import com.asa.photopicker.photo.Utils;
import com.asa.photopicker.photo.Folder.Media;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {
	TextView mTv;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mTv = (TextView) findViewById(R.id.textview);
		mTv.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				PhotoActivity.startMe(MainActivity.this, MessageSelectMediaFragment.DEFAULT_MAX_IMAGE_COUNT, 2333);
			}
		});
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if (resultCode == RESULT_OK) {
			mTv.append("\n : ");
			mTv.append(String.valueOf(requestCode));
			mTv.append("# list size : ");
			ArrayList<Media> medias = data.getParcelableArrayListExtra(Utils.KEY_MEDIAS);
			int size = null != medias ? medias.size() : -1;
			mTv.append(String.valueOf(size));
		}
	}
}
